﻿using System;
using Castle.ActiveRecord;
using CosyTrade.Data;
using CosyTrade.Store;

namespace CosyTrade.Futures
{
    /// <summary>
    /// 采购单内容
    /// </summary>
    [AddPropertyChangedNotifyInterface, PropertyChangedNotify]
    [ActiveRecord("tbStockWares"), Serializable]
    public class StockWares : BusinessObject
    {
        private readonly Guid primaryKey = Guid.NewGuid();
        [PrimaryKey(PrimaryKeyType.Assigned, "ROWGUID", Access = PropertyAccess.NosetterCamelcase)]
        public override Guid PrimaryKey
        {
            get { return primaryKey; }
        }

        /// <summary>
        /// 采购商品
        /// </summary>
        private Product stockProduct;
        /// <summary>
        /// 采购价格
        /// </summary>
        private double stockPrice;
        /// <summary>
        /// 对应采购单
        /// </summary>
        private Guid stockOrderGuid;

        /// <summary>
        /// 采购商品
        /// </summary>
        [BelongsTo]
        public Product StockWare
        {
            get { return stockProduct; }
            set { stockProduct = value; }
        }

        /// <summary>
        /// 采购价格
        /// </summary>
        [Property]
        public double StockPrice
        {
            get { return stockPrice; }
            set { stockPrice = value; }
        }

        /// <summary>
        /// 对应采购单
        /// </summary>
        [Property]
        public Guid StockOrderGuid
        {
            get { return stockOrderGuid; }
            set { stockOrderGuid = value; }
        }
    }
}